<?php

namespace app\common\validate;

use app\common\RootValidate;

class CategoryValidate extends RootValidate
{
    protected $rule = [
        'id' => 'require',
        'state' => 'require',
        'type' => 'require',
        'title' => 'require',
        'name' => 'require',
        'rank' => 'between:0,255',
        'sourceId' => 'require',
        'number' => 'require|gt:0',
        'url' => 'require',
    ];

    protected $message = [
        'id.require' => '栏目无效',
        'state.require' => '请选择栏目状态',
        'type.require' => '请选择任务类型',
        'title.require' => '请选择输入中文名称',
        'name.require' => '请选择输入外语名称',
        'rank.between' => '排序范围在0-255以内的整数',
        'sourceId.require' => '请选择数据来源',
        'number.require' => '请填写采集数量',
        'number.gt' => '采集数量必须大于0',
        'url.require' => '请填写采集地址',
    ];

    protected $scene = [
        'add' => ['state', 'type', 'title', 'name', 'rank'],
        'edit' => ['id', 'state', 'type', 'title', 'name', 'rank'],
        'taskData' => ['sourceId', 'number', 'url']
    ];
}